package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 添加套餐
     * @param setmealDish
     */
    @Insert("  insert into setmeal_dish (setmeal_id ,dish_id,name,price,copies ) values(#{setmealId},#{dishId},#{name},#{price},#{copies})")
    void insertBatch(SetmealDish setmealDish);

    /**
     * 根据套餐id删除表内数据
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void delect(Long id);

    /**
     *根据id查询
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> getById(Long id);
}

